<?php
/* @var $this SettingController */

$this->breadcrumbs=array(
	'Manager Setting'=>array('/settings/manager'),
	'System Setting',
);
?>
<div class="clearfix fix-float-left">
    <?php $form=$this->beginWidget('bootstrap.widgets.TbActiveForm',array(
    'id'=>'setting-form',
    'enableAjaxValidation'=>true,
    'enableClientValidation'=>true,
    'clientOptions'=>array(
        'validateOnSubmit'=>true,
    )
)); ?>
    <div class="alert alert-info">
        <button type="button" class="close" data-dismiss="alert">&times;</button>
        <p><strong>
            <span class="icon16  brocco-icon-mic"></span>
            <?php echo t('Fields with <span class="required">*</span> are required.','fcms'); ?>
        </strong></p>
    </div>
    <div class="row-fluid">
        <div class="tabbable"> <!-- Only required for left/right tabs -->
            <ul class="nav nav-tabs">
                <li class="active"><a href="#tab1" data-toggle="tab"><strong><?php echo t('Server','setting'); ?></strong></a></li>
                <li><a href="#tab2" data-toggle="tab"><strong><?php echo t('Youtube','setting'); ?></strong></a></li>
            </ul>
            <div class="tab-content">
                <div class="tab-pane active" id="tab1">
                    <div class="span6">
                        <fieldset>
                            <legend><?php echo t('Server Settings','setting'); ?></legend>
                            <?php
                            echo $form->toggleButtonRow($model, 'gzip',array('class'=>'nostyle'));
                            echo $form->textAreaRow($model,'google_analytics');
                            echo $form->textFieldRow($model,'cache_time'); ?>
                        </fieldset>
                        <fieldset>
                            <legend><?php echo t('Mail Settings','setting'); ?></legend>
                            <?php
                            echo $form->textFieldRow($model,'emailAdmin');
                            echo $form->textFieldRow($model,'emailFromReply');
                            echo $form->textFieldRow($model,'emailFromNoReply');
                            echo $form->textFieldRow($model,'emailServer');
                            echo $form->textFieldRow($model,'emailPort');
                            echo $form->textFieldRow($model,'emailUser');
                            echo $form->textFieldRow($model,'emailPassword');
                            echo $form->textFieldRow($model,'emailSSL');
                            ?>
                        </fieldset>
                    </div>
                    <div class="span6">
                        <fieldset>
                            <legend><?php echo t('Time & Region Settings','setting'); ?></legend>
                            <div class="timezone clearfix">
                                <?php
                                $data = CHtml::listData(Country::model()->findAll('status = 1 && timezone IS NOT NULL && zone IS NOT NULL'), 'timezone', 'name','zone');
                                if(!$data) {
                                    $data = array(
                                        null=>t('No TimeZone Available','setting'),
                                    );
                                }
                                echo $form->labelEx($model,'time_zone');
                                $this->widget('bootstrap.widgets.TbSelect2', array(
                                    //'asDropDownList' => false,
                                    //'form'=>$form,
                                    'model'=>$model,
                                    'attribute'=>'time_zone',
                                    'data'=>$data,
                                    'options'=>array(
                                        'placeholder'=>t('time_zone','setting'),
                                        'allowClear'=>true,
                                        'width'=>'200px',
                                    ),
                                    'htmlOptions'=>array(
                                        'class'=>'nostyle',
                                    ),
                                ));
                                echo $form->error($model,'time_zone');
                                ?>
                            </div>
                            <?php
                            echo $form->dropDownListRow($model, 'time_format', array(
                                    '24'=>t('24 hour','setting'),
                                    '12'=>t('12 hour','setting'),
                                ),
                                array(
                                    'class'=>'span5',
                                ));
                            ?>
                        </fieldset>
                    </div>
                </div>
                <div class="tab-pane" id="tab2">
                    <fieldset>
                        <legend><?php echo t('Youtube Settings','setting'); ?></legend>
                        <div class="row-fuild">
                        <div class="span6">
                            <?php
                            echo $form->textFieldRow($model,'yb_username');
                            echo $form->PasswordFieldRow($model,'yb_password');
                            echo $form->textFieldRow($model,'yb_service');
                            echo $form->textFieldRow($model,'yb_source');
                            ?>
                        </div>
                       <div class="span6">
                           <?php
                           echo $form->textFieldRow($model,'yb_authenticationURL');
                           echo $form->textFieldRow($model,'yb_devkey');
                           echo $form->textFieldRow($model,'yb_category');
                           echo $form->textFieldRow($model,'yb_handler_url'); ?>
                       </div>
                        </div>
                    </fieldset>
                </div>
            </div>
        </div>
    </div>
    <div class="form-actions">
        <?php $this->widget('bootstrap.widgets.TbButton', array(
        'buttonType'=>'submit',
        'type'=>'primary',
        'label'=>t('Update','setting'),
    ));
        $this->widget('bootstrap.widgets.TbButton', array(
            'buttonType'=>'reset',
            'label'=>t('Reset','setting'),
        ));
        ?>
    </div>

    <?php $this->endWidget(); ?>
</div>
